//
//  HX_CustomCell.m
//  UI19 - Car(汽车之家)
//
//  Created by 韩旭 on 16/8/9.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "HX_CustomCell.h"
#import "CarModel.h"
#import "UIImageView+WebCache.h"
@implementation HX_CustomCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatTableView];
    }
    return self;
}

- (void)setModel:(CarModel *)model {
    _model = model;
    self.lableName.text = model.name;
    [self.imageHeadView sd_setImageWithURL:[NSURL URLWithString:model.imgurl] placeholderImage:nil];

}
- (void)creatTableView {
    self.imageHeadView = [[UIImageView alloc] initWithFrame:CGRectZero];
    _imageHeadView.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:_imageHeadView];
    self.lableName = [[UILabel alloc] initWithFrame:CGRectZero];
    _lableName.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:_lableName];
}
- (void)layoutSubviews {
    [super layoutSubviews];
    _imageHeadView.frame = CGRectMake(10, 10, self.frame.size.width * 0.3, self.frame.size.height - 20);
    _lableName.frame = CGRectMake(_imageHeadView.frame.size.width + _imageHeadView.frame.origin.x + 10, _imageHeadView.frame.origin.y, self.frame.size.width * 0.6, _imageHeadView.frame.size.height);
}


@end
